package server.workwithmaster;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import abstractservlet.AbstractServlet;
import autoservice.api.controller.IAutoservice;
import controllers.Autoservice;

@WebServlet("/AddMaster")
public class AddMaster extends AbstractServlet {
	private static final long serialVersionUID = 1L;
	private IAutoservice autoservice = Autoservice.getInstance();
	private static final String NAME = "name";
	private static final String ADD_MASTER_PAGE = "/workwithmasterpages/AddMasterPage.jsp";
	private static final String ADD_MASTER_OPERAT = "add master";

	public AddMaster() {
		super();

	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String parametrs = request.getParameter(NAME);

		super.navigate(request, response, ADD_MASTER_OPERAT, autoservice
				.addMaster(parametrs).get(0), ADD_MASTER_PAGE);

	}

}
